package com.lp.multi.thread.example04;

/**
 * @author: lp
 * @create: 2021-06-21 16:11
 * @description: 插入线程
 */
public class JoinThread implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 200; i++) {
            System.out.println("vip来了，i = " + i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        JoinThread joinThread = new JoinThread();
        Thread thread = new Thread(joinThread);
        for (int i = 0; i < 100; i++) {
            if(i==20){
                thread.start();
                thread.join();
            }
            System.out.println("主线程:i = " + i);
        }

    }
}
